package com.itcam.phaseii.exception_;

public class ArrayIndexOutOfBoundsException_ {
    public static void main(String[] args) {
        int[] arr = {1, 2, 4};
        for (int i = 0; i <= arr.length; i++) {
            try {
                System.out.println(arr[i]);
            } catch (java.lang.Exception e) {
//                throw new RuntimeException(e);
                System.out.println("出现异常的原因: " + e.getClass() + " " + e.getMessage());//输出异常信息
            }
        }
    }
}
